﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MJunction;
using System.Windows.Forms;

namespace L2Tools.L2l2.View
{
    public class SetupListenerImpl : ISetupListener
    {
        private readonly WaitDialog daialog;
        private int count = 0;
        private readonly int max;

        internal SetupListenerImpl(WaitDialog dialog, int max)
        {
            this.daialog = dialog;
            this.max = max;
        }

        public bool IsAbort()
        {
            Application.DoEvents();
            return daialog.IsAborting;
        }

        public void CopyFile(string from, string to)
        {
            daialog.SubMsg = from;
        }

        public void Countup(long size)
        {
            count++;
            daialog.ProgressValue = count;
            daialog.ProgressMsg =
              ((int)(count * 100 / max)).ToString() + "%　" +
              "（" + count.ToString() + " / " + max + " 件）";
        }

    }
}
